package org.wzy.springcloud.feign.api.service;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.wzy.springcloud.feign.api.domain.Person;

import java.util.Collection;


/**
 * <p>{@link Person} 服务(契约)
 * <p>{@link FeignClient#fallback()} ->
 * <li>Fallback class for the specified Feign client interface.
 * <li>The fallback class must implement the interface annotated by this annotation and be a valid spring bean.
 *
 * @author wzy_h
 * @version 1.0
 * @date 20:33 2017/11/5
 * @description
 */
@FeignClient(value = "person-service")//, fallback = PersonServiceFallBack.class)
public interface PersonService {

    @PostMapping(value = "/person/save")
    String save(@RequestBody Person person);

    @GetMapping("/person/find/all")
    Collection<Person> findAll();


    // TODO 完善Feign手动实现
//    @RequestLine("POST /person/save")
//    boolean save(@RequestBody Person person);
//
//    @RequestLine("POST /person/find/all")
//    Collection<Person> findAll();

}
